package tesis.service;

import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;

/**
 *
 * @author diego.gil
 */
public interface CrudService {
    
    EntityManager getEm();

    public <T> T create(T t);

    public <T> T refresh(T t);

    public <T> T find(Object id, Class<T> type);

    public void delete(Object id, Class type);

    public void delete(Object t);

    public <T> T update(T t);

    public List<?> findByNamedQuery(String namedQueryName);

    public List<?> findByNamedQuery(String namedQueryName, Map<String, Object> parameters);

    public List<?> findByNamedQuery(String namedQueryName, int firstResult, int maxResults);

    public List<?> findByNamedQuery(String namedQueryName, Map<String, Object> parameters, int firstResult, int maxResults);
    
    public int findCountByNamedQuery(String namedQueryName);

    public int findCountByNamedQuery(String namedQueryName, Map<String, Object> parameters);
    
    public int findCountByQuery(String queryString);

    public int findCountByQuery(String queryString, Map<String, Object> parameters);
    
    public List<?> findByQuery(String queryString);
    
    public List<?> findByQuery(String queryString, Map<String, Object> parameters);
    
    public List<?> findByQuery(String queryString, int firstResult, int maxResults);

    public List<?> findByQuery(String queryString, Map<String, Object> parameters, int firstResult, int maxResults);

    public List<?> findByNativeQuery(String nativeQuery, Map<String, Object> parameters);

    public List<?> findByNativeQuery(String nativeQuery, Map<String, Object> parameters, int firstResult, int maxResults);

    public int executeNamedQuery(String namedQueryName);

    public int executeNamedQuery(String namedQueryName, Map<String, Object> parameters);

    public int executeQuery(String query);

    public int executeQuery(String query, Map<String, Object> parameters);
}
